package cn.jiyun.pojo;



import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import sun.plugin2.message.Message;

import javax.validation.constraints.*;
import java.util.Date;

@Data
public class Ceshi {

    @NotNull(message = "id 不能为空")
    private Long id;

    @Min(value = 10,message = "年龄必须大于等于10岁")
    private Integer age;

    @Length(min = 5,max = 20,message = "名字的长度必须在5-10之间")
    private String name;

    @Email(message = "邮箱格式错误")
    private String email;

    @NotBlank(message = "地址不能为空")
    private String address;

    @Pattern(regexp = "^[1]([3-9])[0-9]{9}$", message = "请填写正确的手机号")
    private String phone;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @Past(message = "必须是一个过去的时间")
    private Date begin;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @Future(message = "必须是一个将来的时间")
    private Date end;

}
